<template>
    
<div class="mui-numbox" data-numbox-step='1' data-numbox-min='1'>
  <button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
  <input class="mui-numbox-input" type="number" @change="cli" ref="num"/>
  <button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
</div>
    
</template>
<script>
export default {
    mounted(){
        this.mui('.mui-numbox').numbox()
    },
    methods:{
        cli(){
        // this.$refs.num.value;
        // console.log(this.$refs.num.value)
        this.$emit('shops',parseInt(this.$refs.num.value))
        }
    },
    props:["max"],
        // 监听库存数量
        watch:{
            'max':function(newval,oldval){
                // mui设置num最大值
              this.mui(".mui-numbox").numbox().setOption('max',newval);
            }
        }
}
</script>